{{template "admin/public/head.html" .}}
<section>
	<aside>
		{{template "admin/public/nav.html" .}}
	</aside>
	<article>
		<div class="top-title">
			<dl>
				<dt><h1>{{.title}}</h1></dt>
				<dd>&nbsp;</dd>
			</dl>
		</div>
		<!-- <div class="nav1">
			<ul>
				<a href="works_index.html" class="no"><li>全部产品</li></a>
				<a href="works_index.html"><li>产品分类</li></a>
				<a href="works_index.html"><li>产品分类</li></a>
				<a href="works_index.html"><li>产品分类</li></a>
				<a href="works_index.html"><li>产品分类</li></a>
				<a href="works_index.html"><li>产品分类</li></a>
			</ul>
		</div> -->
		<div class="content">
			<div class="release">
				<dl>
					<dt><i class="iconfont">&#xe649;</i> <b>{{.title}}说明</b><br>
						请在发布产品时上传缩略图设计为正方形，防止前台显示图片变形<mark>图片变形</mark> 。上传图片不要大于2M<br>
						<p> <mark>未审核</mark>的产品将不会在小程序中显示,先按是否推荐对产品排序,然后排序数字越大产品位置越靠前</p>
					</dt>
					<!-- <dd><a href="function_index.html"><button type="button" class="button">功能列表</button></a></dd> -->
				</dl>
			</div>

			<form action="" method="get" autocomplete="on" class="form">

				<table class="table1">
					<!-- 控制表格宽度  横向合并 colspan="1"  竖向合并 rowspan="3" -->
					<thead><th width="10%"></th><th width="15%"></th><th width="10%"></th><th width="15%"></th><th width="10%"></th><th width="15%"></th><th width="10%"></th><th width="15%"></th></thead>
					<tr>
						<td class="genre">产品标题</td>
						<td colspan="3">
							<input type="text" class="input95" placeholder="请输入产品标题！" name="title" value="{{.info.title}}">
						</td>
						<td class="genre">所属品牌</td>
						<td colspan="3">
							<select class="select95" name="bid">
								{{range .brand}}
								<option value ="{{.id}}" {{if $.info}}{{if eq $.info.bid .id}}selected{{end}}{{end}}>{{.name}}-{{.gid}}</option>
								{{end}}
							</select>
						</td>
					</tr>
					
					{{if eq .admin_gid "0"}} 
						{{if .info}}
							{{if ne .info.gid "0"}}
							<input type="hidden" name="gid" value="{{.info.gid}}">
							{{else}}
							<tr>
								<td class="genre">所属店铺</td>
								<td colspan="3"><input type="text" class="input70" placeholder="店铺id" value="{{.info.gid}}" name="gid" list="gid">
									<datalist id="gid">
									</datalist>
									<button type="button" class="inputbutton" data-type="shop">搜索店铺</button>
								</td>
								<td class="genre">店铺栏目</td>
								<td colspan="3">
									<select class="select95" name="gcid">
									</select>
								</td>
							</tr>
							<tr>
								<td class="genre">店铺排序</td>
								<td colspan="3">
									<input type="number" class="input95" placeholder="请输入店铺排序！" name="gsort" value="{{.info.gsort}}">
								</td>
								<td class="genre">店铺推荐</td>
								<td colspan="3">
									<label class="demo--label"><input class="demo--radio" type="radio" name="grecommend" value="0" {{if .info}}{{if eq .info.grecommend "0"}}checked{{end}}{{else}}checked{{end}}><span class="demo--radioInput"></span>未推荐</label>
									<label class="demo--label"><input class="demo--radio" type="radio" name="grecommend" value="1" {{if .info}}{{if eq .info.grecommend "1"}}checked{{end}}{{end}}><span class="demo--radioInput"></span>已推荐</label>
								</td>
							</tr>
							{{end}}
							{{else}}
							<tr>
								<td class="genre">所属店铺</td>
								<td colspan="3"><input type="text" class="input70" placeholder="店铺id" value="{{.info.gid}}" name="gid" list="gid">
									<datalist id="gid">
									</datalist>
									<button type="button" class="inputbutton" data-type="shop">搜索店铺</button>
								</td>
								<td class="genre">店铺栏目</td>
								<td colspan="3">
									<select class="select95" name="gcid">
									</select>
								</td>
							</tr>
							<tr>
								<td class="genre">店铺排序</td>
								<td colspan="3">
									<input type="number" class="input95" placeholder="请输入店铺排序！" name="gsort" value="{{.info.gsort}}">
								</td>
								<td class="genre">店铺推荐</td>
								<td colspan="3">
									<label class="demo--label"><input class="demo--radio" type="radio" name="grecommend" value="0" {{if .info}}{{if eq .info.grecommend "0"}}checked{{end}}{{else}}checked{{end}}><span class="demo--radioInput"></span>未推荐</label>
									<label class="demo--label"><input class="demo--radio" type="radio" name="grecommend" value="1" {{if .info}}{{if eq .info.grecommend "1"}}checked{{end}}{{end}}><span class="demo--radioInput"></span>已推荐</label>
								</td>
							</tr>
							{{end}}
					{{else}}
					<input type="hidden" name="gid" value="{{.info.gid}}">
					<!-- <tr>
						<td class="genre">店铺栏目</td>
						<td colspan="7">
							<select class="select95" name="gcid">
								{{range .gcolumn}}
								<option value="{{.id}}" {{if $.info.gcid}}selected{{end}}>{{.name}}</option>
								{{end}}
							</select>
						</td>
					</tr> -->
					{{end}} 
					<tr>
						<td class="genre">产品主平台栏目</td>
						<td colspan="4">
							<select class="select30" name="cid1">
								{{range .column1}}
									<option value="{{.id}}" {{if $.info.cid1}}{{if eq $.info.cid1 .id}}selected{{end}}{{end}}>{{.name}}</option>
								{{end}}
							</select>
							<select class="select30" name="cid2">
								{{if .column2}}
								{{range .column2}}
									<option value="{{.id}}" {{if $.info}}{{if $.info.cid2}}{{if eq $.info.cid2 .id}}selected{{end}}{{end}}{{end}}>{{.name}}</option>
								{{end}}
								{{end}}
							</select>
							<select class="select30" name="cid3">
								{{if .column3}}
								{{range .column3}}
									<option value="{{.id}}" {{if $.info}}{{if eq $.info.cid .id}}selected{{end}}{{end}}>{{.name}}</option>
								{{end}}
								{{end}}
							</select>
						</td>
						<td class="genre">条形码</td>
						<td colspan="2">
							<input  name="barcode" placeholder="请输入条形码" value="{{.info.barcode}}" class="input95">
						</td>
					</tr>
					{{if .column2}}
					{{range (index .column2 0 "acolumn")}}
					<tr class="attr">
						<td class="genre">{{.name}}</td>
						<td colspan="7">
							{{range .attribute}}
							<label class="checkbox"><input type="checkbox" name="attr" value="{{.id}}" {{if $.info.attr}}{{tipcheck .id $.info.attr}}{{end}}>{{.name}}</label>
							{{end}}
						</td>
					</tr>
					{{end}}
					{{end}}
					<tr>
						<td class="genre">关键词</td>
						<td colspan="3">
							<input type="text" class="input95" placeholder="请输入型号！" name="keywords" value="{{.info.keywords}}">
						</td>
						<td class="genre">产品尺寸</td>
						<td colspan="3">
							<input type="text" class="input95" placeholder="请输入产品尺寸！" name="size" value="{{if eq .admin_gid "0"}}{{.info.size}}{{else}}{{.info.size}}{{end}}">
						</td>
					</tr>
					<tr>
						<td class="genre">装箱长度(cm)</td>
						<td colspan="2">
							<input type="number" class="input95" placeholder="请输入装箱长度！" name="length" value="{{.info.length}}">
						</td>
						<td class="genre">装箱宽度(cm)</td>
						<td colspan="2">
							<input type="text" class="input95" placeholder="请输入装箱宽度！" name="width" value="{{.info.width}}">
						</td>
						<td class="genre">装箱高度(cm)</td>
						<td colspan="2">
							<input type="number" class="input95" placeholder="请输入装箱高度！" name="height" value="{{.info.height}}">
						</td>
					</tr>
					<tr>
						<td class="genre">价格</td>
						<td colspan="3">
							<input type="number" class="input95" placeholder="请输入价格！" name="price" value="{{if eq .admin_gid "0"}}{{.info.mprice}}{{else}}{{.info.price}}{{end}}">
						</td>
						<td class="genre">型号</td>
						<td colspan="3">
							<input type="text" class="input95" placeholder="请输入型号！" name="model" value="{{.info.model}}">
						</td>
					</tr>
					<tr>
						<td class="genre">装箱规格</td>
						<td colspan="3">
							<select name="spec" class="select95">
								<option value="个" {{if .info}}{{if eq .info.spec "个"}}selected{{end}}{{end}}>个</option>
								<option value="片" {{if .info}}{{if eq .info.spec "片"}}selected{{end}}{{end}}>片</option>
								<option value="张" {{if .info}}{{if eq .info.spec "张"}}selected{{end}}{{end}}>张</option>
								<option value="块" {{if .info}}{{if eq .info.spec "块"}}selected{{end}}{{end}}>块</option>
								<option value="把" {{if .info}}{{if eq .info.spec "把"}}selected{{end}}{{end}}>把</option>
								<option value="包" {{if .info}}{{if eq .info.spec "包"}}selected{{end}}{{end}}>包</option>
								<option value="桶" {{if .info}}{{if eq .info.spec "桶"}}selected{{end}}{{end}}>桶</option>
								<option value="套" {{if .info}}{{if eq .info.spec "套"}}selected{{end}}{{end}}>套</option>
							</select>
							<!-- <input type="text" class="input95" placeholder="请输入装箱规格！如个,片..." name="spec" value="{{.info.spec}}"> -->
						</td>
						<td class="genre">装箱数</td>
						<td colspan="3">
							<input type="number" class="input95" placeholder="请输入装箱数！" name="number" value="{{.info.number}}">
						</td>
					</tr>
					
					<tr>
						<td class="genre">材质</td>
						<td colspan="3">
							<input type="text" class="input95" placeholder="请输入材质！" name="material" value="{{.info.material}}">
						</td>
						<td class="genre">单个重量(g)</td>
						<td colspan="3">
							<input type="number" class="input95" placeholder="请输入单个重量！" name="weight" value="{{.info.weight}}">
						</td>
					</tr>
					<tr>
						<td class="genre">库存</td>
						<td colspan="3">
							<input type="number" class="input95" placeholder="请输入库存！" name="inventory" value="{{.info.inventory}}">
						</td>
						<td class="genre">销量</td>
						<td colspan="3">
							<input type="number" class="input95" placeholder="请输入销量！" name="sellnum" value="{{.info.sellnum}}">
						</td>
					</tr>
					{{if eq .admin_gid "0"}}
					<tr>
						<td class="genre">商品结构设置</td>
						<td colspan="7">
							{{range .proStruct}}
							<label class="checkbox product">
								<input type="checkbox" name="productstruct" ids="{{$.info.id}}" pid="{{.pid}}" value="{{.id}}" {{if $.info.id}}{{tipcheck $.info.id .pid}}{{end}}>{{.name}}
							</label>
							{{end}}
						</td>
					</tr>
					{{end}}
					<tr>
						<td class="genre">是否支持推广</td>
						<td colspan="3">
							<label class="demo--label"><input class="demo--radio" type="radio" name="ispromote" value="1" {{if .info}}{{if eq .info.ispromote "1"}}checked{{end}}{{else}}checked{{end}}><span class="demo--radioInput"></span>支持</label>
							<label class="demo--label"><input class="demo--radio" type="radio" name="ispromote" value="0" {{if .info}}{{if eq .info.ispromote "0"}}checked{{end}}{{end}}><span class="demo--radioInput"></span>不支持</label>
						</td>
						<td class="genre">计算方式</td>
						<td colspan="3">
							<label class="demo--label"><input class="demo--radio" type="radio" name="isw" value="0" {{if .info}}{{if eq .info.isw "0"}}checked{{end}}{{else}}checked{{end}}><span class="demo--radioInput"></span>体积</label>
							<label class="demo--label"><input class="demo--radio" type="radio" name="isw" value="1" {{if .info}}{{if eq .info.isw "1"}}checked{{end}}{{end}}><span class="demo--radioInput"></span>重量</label>
						</td>
					</tr>
					<tr>
						<td class="genre">排序</td>
						<td colspan="3">
							<input type="number" class="input95" placeholder="请输入排序！" name="sort" value="{{.info.sort}}">
						</td>
						<td class="genre">点击数</td>
						<td colspan="3">
							<input type="number" class="input95" placeholder="请输入点击数！" name="click" value="{{.info.click}}">
						</td>
					</tr>
					<tr>
						<td class="genre">精品推荐</td>
						<td colspan="3">
							<label class="demo--label"><input class="demo--radio" type="radio" name="recom" value="0" {{if .info}}{{if eq .info.recom "0"}}checked{{end}}{{else}}checked{{end}}><span class="demo--radioInput"></span>普通商品</label>
							<label class="demo--label"><input class="demo--radio" type="radio" name="recom" value="1" {{if .info}}{{if eq .info.recom "1"}}checked{{end}}{{end}}><span class="demo--radioInput"></span>推荐</label>
						</td>
						<td class="genre">有好货</td>
						<td colspan="3">
							<label class="demo--label"><input class="demo--radio" type="radio" name="good" value="0" {{if .info}}{{if eq .info.good "0"}}checked{{end}}{{else}}checked{{end}}><span class="demo--radioInput"></span>普通商品</label>
							<label class="demo--label"><input class="demo--radio" type="radio" name="good" value="1" {{if .info}}{{if eq .info.good "1"}}checked{{end}}{{end}}><span class="demo--radioInput"></span>有好货</label>
						</td>
					</tr>
					<tr>
						<td class="genre">必买清单</td>
						<td colspan="3">
							<label class="demo--label"><input class="demo--radio" type="radio" name="mbuy" value="0" {{if .info}}{{if eq .info.mbuy "0"}}checked{{end}}{{else}}checked{{end}}><span class="demo--radioInput"></span>普通商品</label>
							<label class="demo--label"><input class="demo--radio" type="radio" name="mbuy" value="1" {{if .info}}{{if eq .info.mbuy "1"}}checked{{end}}{{end}}><span class="demo--radioInput"></span>必买清单</label>
						</td>
						<td class="genre">起购数量</td>
						<td colspan="3">
							<input type="number" class="input95" placeholder="请输入起购数量" name="minbuy" value="{{.info.minbuy}}">
						</td>
					</tr>
					<tr>
						<td class="genre">上下架</td>
						<td colspan="1">
							<label class="demo--label"><input class="demo--radio" type="radio" name="censoring" value="1" {{if .info}}{{if eq .info.censoring "1"}}checked{{end}}{{else}}checked{{end}}><span class="demo--radioInput"></span>上架</label>
							<label class="demo--label"><input class="demo--radio" type="radio" name="censoring" value="0" {{if .info}}{{if eq .info.censoring "0"}}checked{{end}}{{end}}><span class="demo--radioInput"></span>下架</label>
						</td>
						<td class="genre">推荐</td>
						<td colspan="1">
							<label class="demo--label"><input class="demo--radio" type="radio" name="recommend" value="0" {{if .info}}{{if eq .info.recommend "0"}}checked{{end}}{{else}}checked{{end}}><span class="demo--radioInput"></span>未推荐</label>
							<label class="demo--label"><input class="demo--radio" type="radio" name="recommend" value="1" {{if .info}}{{if eq .info.recommend "1"}}checked{{end}}{{end}}><span class="demo--radioInput"></span>已推荐</label>
						</td>
						<td class="genre">显示</td>
						<td colspan="1">
							<label class="demo--label"><input class="demo--radio" type="radio" name="is_show" value="0" {{if .info}}{{if eq .info.is_show "0"}}checked{{end}}{{else}}checked{{end}}><span class="demo--radioInput"></span>隐藏</label>
							<label class="demo--label"><input class="demo--radio" type="radio" name="is_show" value="1" {{if .info}}{{if eq .info.is_show "1"}}checked{{end}}{{end}}><span class="demo--radioInput"></span>显示</label>
						</td>
					</tr>
					<tr>
						<td class="genre">是否支持vip购买</td>
						<td colspan="3">
							<label class="demo--label"><input class="demo--radio" type="radio" name="isvip" value="1" {{if .info}}{{if eq .info.isvip "1"}}checked{{end}}{{else}}checked{{end}}><span class="demo--radioInput"></span>支持</label>
							<label class="demo--label"><input class="demo--radio" type="radio" name="isvip" value="0" {{if .info}}{{if eq .info.isvip "0"}}checked{{end}}{{end}}><span class="demo--radioInput"></span>不支持</label>
						</td>
						{{if eq .admin_gid "0"}}
						<td class="genre">销量显示</td>
						<td colspan="3">
							<label class="demo--label"><input class="demo--radio" type="radio" name="issellnum" value="1" {{if .info}}{{if eq .info.issellnum "1"}}checked{{end}}{{else}}checked{{end}}><span class="demo--radioInput"></span>显示真实销量</label>
							<label class="demo--label"><input class="demo--radio" type="radio" name="issellnum" value="0" {{if .info}}{{if eq .info.issellnum "0"}}checked{{end}}{{end}}><span class="demo--radioInput"></span>显示预设销量</label>
						</td>
						{{end}}
					</tr>
					<tr>
						<td class="genre">缩略图</td>
						<td colspan="7">
							<div class="thumbnail">
								<dl><dt><img src="{{if .info.pathname}}{{.info.pathname}}{{else}}/static/img/admin/uppic.png{{end}}" class="uppic"><input type="file" onchange="uppic(this,'function')" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
									<input type="hidden" name="img" value="{{.info.img}}"></dt><dd>缩略图</dd><dd class="del_img">删除图片</dd></dl>
								<dl><dt><img src="{{index .imgs 0}}" class="uppic"><input type="file" onchange="uppic(this,'works')" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
									<input type="hidden" name="image" value="{{index .picnum 0}}"></dt><dd>轮播图 X1</dd><dd class="del_img">删除图片</dd></dl>
								<dl><dt><img src="{{index .imgs 1}}" class="uppic"><input type="file" onchange="uppic(this,'works')" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
									<input type="hidden" name="image" value="{{index .picnum 1}}"></dt><dd>轮播图 X2</dd><dd class="del_img">删除图片</dd></dl>
								<dl><dt><img src="{{index .imgs 2}}" class="uppic"><input type="file" onchange="uppic(this,'works')" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
									<input type="hidden" name="image" value="{{index .picnum 2}}"></dt><dd>轮播图 X3</dd><dd class="del_img">删除图片</dd></dl>
								<dl><dt><img src="{{index .imgs 3}}" class="uppic"><input type="file" onchange="uppic(this,'works')" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
									<input type="hidden" name="image" value="{{index .picnum 3}}"></dt><dd>轮播图 X4</dd><dd class="del_img">删除图片</dd></dl>
							</div>
						</td>
					</tr>
					<!-- <tr>
						<td class="genre">视频</td>
						<td colspan="7">
							<input type="text" name="video" value="{{.info.video}}" class="input95" readonly="" placeholder="点击上传视频">
							<input type="file" class="file_input" accept="video/ogg,video/mp4,video/webm" onchange="fileup(this,'product')">
						</td>
					</tr> -->
					<tr>
						<td class="genre">简介</td>
						<td colspan="7">
							<textarea placeholder="请输入内容简介，200字内。" class="textarea95" name="description">{{.info.description}}</textarea>
						</td>
					</tr>
					<tr>
						<td colspan="8"><textarea id="editor1">{{if .info.content}}{{str2html .info.content}}{{end}}</textarea></td>
					</tr>
					<input type="hidden" name="id" value="{{.info.id}}">
			</form>
					<tr class="trbutton">
						<td colspan="2">
							<button type="button" class="button" value='1'>保存</button>
							{{if lt .adminC.permission "8"}}
							{{if eq .adminC.gid "0"}}
							<button type="button" class="button" value='2'>保存并同步</button>
							{{end}}
							{{end}}
						</td>
						<td colspan="6">
							<p>
								<i class="iconfont">&#xe649;</i> 请检查内容确认发布的内容没有涉及传播谣言、政治话题或违反广告法夸大宣传产品等。
							</p>
							<div class="help">帮助
								<div class="help_qr"><img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/all/qr-code.jpg" alt=""></div>
							</div>
						</td>
					</tr>
				</table>
		</div>
	</article>
</section>

<footer><!-- 系统监控内容 --></footer>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/jquery.jedate.min.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/toast.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/uppic.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/xcConfirm.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/app.js"></script>
<script type="text/javascript">
						$('select[name="bid"]').change(function(){
							$('input[name="gid"]').val($(this).find("option:selected").text().split("-")[1])
						})
					</script>
<script type="text/javascript">
	$('input[name="gid"]').change(function(){
		var gid=$(this).val()
		if(gid>0){
			$.ajax({
				url:'/admin/column/get_g',
				data:{gid:gid},
				success:function(res){
					var html=''
					if(res){
						for (var i=0;i<res.length;i++){
							html+=`<option value="`+res[i].id+`" >`+res[i].name+`</option>`
						}
					}else{
						html='<option value="0" >无结果,请先添加店铺栏目</option>'
					}
					$('select[name="gcid"]').html(html)
				}
			})
		}
	})
</script>
	<script>
		var column2={{.column2}};
		$('select[name="cid1"]').change(function(){
			var id=$(this).val()
			var name=$(this).attr("name")
			var that=$(this)
			var type
			if (name=="cid1"){
				type=0
			}else{
				type=1
			}
			$.ajax({
				url:'/admin/column/get',
				data:{id:id,type:type},
				success:function(res){
					column2=res.column2
					var html=''
					if(res.column2){
						for (var i=0;i<res.column2.length;i++){
							html+=`<option value="`+res.column2[i].id+`" >`+res.column2[i].name+`</option>`
						}
						if (type==0){
							$('.attr').remove()
							var acolumn=res.column2[0].acolumn
							var htmlcolumn=''
							if (acolumn){
								for(var i=0;i<acolumn.length;i++){
									htmlcolumn+=`<tr class="attr">
										<td class="genre">`+acolumn[i].name+`</td>
										<td colspan="7">`
										if(acolumn[i].attribute){
											for (var j=0;j<acolumn[i].attribute.length;j++){
												htmlcolumn+=`<label class="checkbox"><input type="checkbox" name="attr" value="`+acolumn[i].attribute[j].id+`">`+acolumn[i].attribute[j].name+`</label>`
											}
										}
										htmlcolumn+=`</td></tr>`
								}
								that.parent().parent().after(htmlcolumn)
							}
						}
					}
					if (name=="cid1"){
						$('select[name="cid2"]').html(html)
					}else{
						$('select[name="gcid2"]').html(html)
					}
					var html2=''
					if(res.column3){
						for (var i=0;i<res.column3.length;i++){
							html2+=`<option value="`+res.column3[i].id+`" >`+res.column3[i].name+`</option>`
						}
					}
					if (name=="cid1"){
						$('select[name="cid3"]').html(html2)
					}else{
						$('select[name="gcid3"]').html(html2)
					}
				}
			})
		})
		$('select[name="cid2"],select[name="gcid2"]').change(function(){
			var id=$(this).val();
			var name=$(this).attr("name");
			var that=$(this)
			var type;
			if (name=="cid2"){
				type=0;
				$('.attr').remove();
				if(column2){	
					for(var j=0;j<column2.length;j++){
						if(id==column2[j].id){
							var acolumn=column2[j].acolumn;
							var htmlcolumn='';
							if (acolumn){
								for(var i=0;i<acolumn.length;i++){
									htmlcolumn+=`<tr class="attr">
										<td class="genre">`+acolumn[i].name+`</td>
										<td colspan="7">`;
										if(acolumn[i].attribute){
											for (var j=0;j<acolumn[i].attribute.length;j++){
												htmlcolumn+=`<label class="checkbox"><input type="checkbox" name="attr" value="`+acolumn[i].attribute[j].id+`">`+acolumn[i].attribute[j].name+`</label>`;
											};
										};
										htmlcolumn+=`</td></tr>`;
								};
								that.parent().parent().after(htmlcolumn);
							};
						};
					};
				}
			}else{
				type=1
			}
			$.ajax({
				url:'/admin/column/get',
				data:{id:id,type:type},
				success:function(res){
					var html=''
					if(res.column3){
						for (var i=0;i<res.column3.length;i++){
							html+=`<option value="`+res.column3[i].id+`" >`+res.column3[i].name+`</option>`
						}
					}
					if (name=="cid2"){
						$('select[name="cid3"]').html(html)
					}else{
						$('select[name="gcid3"]').html(html)
					}
				}
			})
		})
	</script>
<script>
	CKEDITOR.replace('editor1');
	$('.button').click(function(){
		if (!$('input[name="title"]').val()){
			window.wxc.xcConfirm("请输入产品标题！","info"); return false;
		}
		if (!$('input[name="img"]').val()){
			window.wxc.xcConfirm("请上传缩略图！","info"); return false;
		}
		console.log($('input[name="barcode"]').val().trim().length)
		if ($('input[name="barcode"]').val().trim().length != 15 && $('input[name="barcode"]').val().trim().length != 13) {
			window.wxc.xcConfirm("条形码输入有误,请仔细检查!","info"); 
			return false;
		}
		{{if eq .admin_gid "0"}}
		if (!$('input[name="gid"]').val()>0){
			window.wxc.xcConfirm("请设置店铺！","info"); return false;
		}
		{{end}}
		if (!$('input[name="model"]').val()){
			window.wxc.xcConfirm("请输入型号！","info"); return false;
		}
		// if (!$('input[name="size"]').val()) {
		// 	window.wxc.xcConfirm("请输入尺寸!","info"); return false;
		// }
		// if (!$('textarea[name="description"]').val()){
		// 	window.wxc.xcConfirm("请输入简介！","info"); return false;
		// }
		if (!$('input[name="price"]').val()){
			window.wxc.xcConfirm("请输入价格！","info"); return false;
		}
		// if (!$('input[name="spec"]').val()){
		// 	window.wxc.xcConfirm("请输入装箱规格！","info"); return false;
		// }
		if (!$('input[name="number"]').val()){
			window.wxc.xcConfirm("请输入装箱数！","info"); return false;
		}
		if (!$('input[name="length"]').val()){
			window.wxc.xcConfirm("请输入装箱长度！","info"); return false;
		}
		if (!$('input[name="width"]').val()){
			window.wxc.xcConfirm("请输入装箱宽度！","info"); return false;
		}
		if (!$('input[name="height"]').val()){
			window.wxc.xcConfirm("请输入装箱高度！","info"); return false;
		}
		// if (!$('input[name="material"]').val()){
		// 	window.wxc.xcConfirm("请输入材质！","info"); return false;
		// }
		// if (!$('input[name="weight"]').val()){
		// 	window.wxc.xcConfirm("请输入单个重量！","info"); return false;
		// }
		if ($('input[name="minbuy"]').val()<1) {
			window.wxc.xcConfirm("起购数量最小为1！","info"); return false;
		}
		var a=CKEDITOR.instances.editor1.getData();
		var form=$('form').serialize()
		form=form+'&content='+encodeURIComponent(a)+'&synchronize='+encodeURIComponent($(this).val())
		$.ajax({
			url:window.location.href,
			data:form,
			type:'post',
			success:function(res){
				if(res==1){
					 window.wxc.xcConfirm("保存成功","success",{onClose:function(){
                        window.location.href = document.referrer
                    }})
				}else if(res == 0) {
					 window.wxc.xcConfirm("保存失败,请重试!","error")
				}else{
					window.wxc.xcConfirm(res.msg,"error")
				}
			}
		})
	});
</script>
</body>
</html>
